package com.idealighter.game.server.db.datadb.mapper;

import com.idealighter.game.server.db.datadb.generate.mapper.RoomCardGroupDomainMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface RoomCardGroupMapper extends RoomCardGroupDomainMapper {

  @Update("update room_card_group set member_num = member_num + 1 where id  = #{groupId}")
  int increaseMembers(@Param("groupId") int groupId);

  @Update("update room_card_group set member_num = member_num - 1 where id  = #{groupId} "
      + "and member_num > 0")
  int decreaseMembers(@Param("groupId") int groupId);

  @Update("update room_card_group set room_num = room_num + #{num} where id  = #{groupId}")
  int increaseRoomNum(@Param("groupId") int groupId, @Param("num") int num);

  @Update("update room_card_group set room_num = room_num - #{num} where id  = #{groupId} "
      + "and room_num >= #{num}")
  int decreaseRoomNum(@Param("groupId") int groupId, @Param("num") int num);
}
